<!DOCTYPE html>
<html>
<head>
    <title>模块管理</title>
    <link rel="stylesheet" href="__STATIC__/js/layui-v2.5.5/css/layui.css">
</head>
<body>
	<!-- layui-tab开始 -->
	<div class="layui-tab " lay-filter="demo-tab">
	
		<div class="layui-card">
			<div class="layui-card-body layui-nopadding " >
			
				<form class="layui-form" action="">
				    <div class="layui-form-item">
						<label class="layui-form-label">name</label>
						<div class="layui-input-block">
							<input type="text" name="name" lay-verify="name" autocomplete="off" placeholder="模块标识(英文名)" class="layui-input" value="{$da->name}" disabled>
						</div>
				    </div>
					<input type="hidden" name="id" value="{$da->id}">
					<div class="layui-form-item">
						<label class="layui-form-label">title</label>
						<div class="layui-input-block">
							<input type="text" name="title" lay-verify="title" autocomplete="off" placeholder="标题" class="layui-input" value="{$da->title}">
						</div>
				    </div>
					
					<div class="layui-form-item">
						<label class="layui-form-label">category</label>
						<div class="layui-input-block">
							<select name="category">
								<option value="">分类选择</option>
								<volist name="$category" id="vo">
									<option value="{$vo.id}"  <?php if( $vo['id'] == $da->category ) echo "selected"; ?> >{$vo.name}</option>
								</volist>
							</select>
						</div>
				    </div>
					
					<div class="layui-form-item">
						<label class="layui-form-label">状态</label>
						<div class="layui-input-block">
							<select name="status">
								<option value="">选择状态</option>
								<option value="0"  <?php if( $da->status ==0)  echo 'selected';?> >开发中</option>
								<option value="4"  <?php if( $da->status ==4)  echo 'selected';?> >完成</option>
							</select>
						</div>
				    </div>
					
					<div class="layui-form-item">
						<label class="layui-form-label">describe</label>
						<div class="layui-input-block">
							<input type="text" name="describe" lay-verify="describe" autocomplete="off" placeholder="模块描述" class="layui-input" value="{$da->describe}">
						</div>
				    </div>
					
					<div class="layui-form-item">
						<div class="layui-input-block">
							 <button type="submit" id="add_submit_btn" style="display:none;" class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
						</div>
				    </div>
					
				</form>
				
			</div>
		</div>
	</div>
	<!-- layui-tab结束-->
<script src="__STATIC__/js/jquery.js"></script>
<script src="__STATIC__/js/layui-v2.5.5/layui.all.js"></script>
<script type="text/javascript">
	;!function(){
		var form = layui.form
			,layer = layui.layer    //弹出层必需
			,layedit = layui.layedit  //富文本必需
			,laydate = layui.laydate  //日期选择必需
			,table = layui.table  //表格必需
			,element = layui.element;  //选项卡	
			
			//监听提交
		form.on('submit(demo1)', function(data){
		console.log( data );
			$.post( '{:url("ModuleManage/editModulePost")}' , data.field, function( res ){
				let icon = ( res.code == 200 ) ? 1 : 5 ;
				layer.msg( res.message , { icon:icon , time:800 } , function(){
					if( icon == 1 ) {
						parent.location.reload();
						parent.layer.closeAll();
					}
				} );
			});
			return false;
		});
 
	}();
	
	var callback = function( index ){
		$( '#add_submit_btn' ).click();
	}
	
	
</script>


</body>
</html>